package pers.ljf.escloud.service.modules.app.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import pers.ljf.escloud.dao.entity.app.ShortLinkConfig;
import pers.ljf.escloud.dao.mapper.app.ShortLinkConfigMapper;
import pers.ljf.escloud.service.modules.app.ShortLinkConfigService;

import javax.annotation.Resource;

@Service
public class ShortLinkConfigServiceImpl extends ServiceImpl<ShortLinkConfigMapper, ShortLinkConfig> implements ShortLinkConfigService {
    @Resource
    private ShortLinkConfigMapper shortLinkConfigMapper;

    @Override
    public ShortLinkConfig findByUrl(String fullPath) {
        return getOne(new QueryWrapper<ShortLinkConfig>().eq("url", fullPath));
    }

    @Override
    public ShortLinkConfig findByKey(String randomKey) {
        return getOne(new QueryWrapper<ShortLinkConfig>().eq("file_key", randomKey));
    }
}
